﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZX.Web.UI.Controls;
using ZX.BLL;
using ZX.SYS.Library;
using ZX.Web.UI.Controls.ControlBind;
using ZX.CRM.Library;
using ZX.CRM.Bussiness;

namespace ZX.WebApp.Crm.Customer
{
    public partial class AddCustomerRelation : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            BDatPhraseDetail bllDetail = new BDatPhraseDetail();
            BTCrmCustomer bll = new BTCrmCustomer();
            //客户关系
            IList<DatPhraseDetail> listCustomerRelation = bllDetail.GetDatPhraseDetailByClassValue("CustomerRelation");
            DropDownListControl.DropDataSourceBind(this.CustomerRelation, listCustomerRelation, "PhraseText", "PhraseID");
            string strRelationId = this.GetStringFromQueryString("rid", "");
            if (strRelationId != "")
            {
                IList<V_CrmCustomerRelationInfo> listRelationInfo = bll.GetCrmCustomerRelationInfo(new Guid(strRelationId));
                if (listRelationInfo != null && listRelationInfo.Count > 0)
                {
                    this.RelationCustomerName.Value = listRelationInfo[0].RelationCustomerID.ToString();
                    this.txtRelationCustomerName.Value = listRelationInfo[0].RelationCustomerName;
                    this.Explain.Text = listRelationInfo[0].Explain;
                    DropDownListControl.DropDownListSelect(this.CustomerRelation, listRelationInfo[0].CustomerRelation.ToString());
                }
            }                        
        }
        /// <summary>
        /// 获取客户ID
        /// </summary>
        public string CustomerId
        {
            get { return this.GetStringFromQueryString("id", ""); }
        }
        /// <summary>
        /// 客户关系ID
        /// </summary>
        public string RelationId
        {
            get { return this.GetStringFromQueryString("rid",""); }
        }
    }
}